﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Threading;
using System.Globalization;

namespace PHTShop
{
    public class basePageUser:System.Web.UI.Page
    {

        protected override void InitializeCulture()
        {
            base.InitializeCulture();
            string lang ="English";
            if (Request.QueryString["lang"] != null)
            {
                switch (Request.QueryString["lang"].ToString())
                {
                    case "gr": lang = "Germany"; break;
                    case "fr": lang = "France"; break;
                    default: lang = "English"; break;
                }
                Session["languages"] = lang;
               
            }
            else
                if (Session["languages"] == null)
                    Session["languages"] = lang;
                else
                    lang = Session["languages"].ToString();
            string culture = "";


            switch (lang.ToLower())
            {
                case "germany": culture = "de-DE"; break;
                case "france": culture = "fr-FR"; break;
                default: culture = "en-US"; break;
            }
            
            Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(culture);
            Thread.CurrentThread.CurrentUICulture = new CultureInfo(culture);
        }
    }
}